home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-9.10-netbook-remix-PL.iso / casper / filesystem.squashfs / usr / share / system-config-printer / troubleshoot / QueueNotEnabled.py < prev    next >
Text File  |  2009-10-19  |  3KB  |  81 lines

  1. #!/usr/bin/env python
  2.  
  3. ## Printing troubleshooter
  4.  
  5. ## Copyright (C) 2008, 2009 Red Hat, Inc.
  6. ## Copyright (C) 2008, 2009 Tim Waugh <twaugh@redhat.com>
  7.  
  8. ## This program is free software; you can redistribute it and/or modify
  9. ## it under the terms of the GNU General Public License as published by
  10. ## the Free Software Foundation; either version 2 of the License, or
  11. ## (at your option) any later version.
  12.  
  13. ## This program is distributed in the hope that it will be useful,
  14. ## but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16. ## GNU General Public License for more details.
  17.  
  18. ## You should have received a copy of the GNU General Public License
  19. ## along with this program; if not, write to the Free Software
  20. ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21.  
  22. import cups
  23. from base import *
  24. class QueueNotEnabled(Question):
  25.     def __init__ (self, troubleshooter):
  26.         Question.__init__ (self, troubleshooter, "Queue not enabled?")
  27.         self.label = gtk.Label ()
  28.         solution = gtk.VBox ()
  29.         self.label.set_line_wrap (True)
  30.         self.label.set_alignment (0, 0)
  31.         solution.pack_start (self.label, False, False, 0)
  32.         solution.set_border_width (12)
  33.         troubleshooter.new_page (solution, self)
  34.  
  35.     def display (self):
  36.         answers =  self.troubleshooter.answers
  37.         if not answers['cups_queue_listed']:
  38.             return False
  39.  
  40.         if answers['is_cups_class']:
  41.             queue = answers['cups_class_dict']
  42.         else:
  43.             queue = answers['cups_printer_dict']
  44.  
  45.         enabled = queue['printer-state'] != cups.IPP_PRINTER_STOPPED
  46.         if enabled:
  47.             return False
  48.  
  49.         if answers['cups_printer_remote']:
  50.             attrs = answers['remote_cups_queue_attributes']
  51.             reason = attrs['printer-state-message']
  52.         else:
  53.             reason = queue['printer-state-message']
  54.  
  55.         if reason:
  56.             reason = _("The reason given is: '%s'.") % reason
  57.         else:
  58.             reason = _("This may be due to the printer being disconnected or "
  59.                        "switched off.")
  60.  
  61.         text = ('<span weight="bold" size="larger">' +
  62.                 _("Queue Not Enabled") + '</span>\n\n' +
  63.                 _("The queue '%s' is not enabled.") %
  64.                 answers['cups_queue'])
  65.  
  66.         if reason:
  67.             text += ' ' + reason
  68.  
  69.         if not answers['cups_printer_remote']:
  70.             text += '\n\n'
  71.             text += _("To enable it, select the 'Enabled' checkbox in the "
  72.                       "'Policies' tab for the printer in the printer "
  73.                       "administration tool.")
  74.             text += ' ' + TEXT_start_print_admin_tool
  75.  
  76.         self.label.set_markup (text)
  77.         return True
  78.  
  79.     def can_click_forward (self):
  80.         return False
  81.